<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:pe="http://primefaces.org/ui/extensions"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:body>
        <ui:composition template="/resources/template/template.xhtml">
            <ui:define name="content">
                <h:form>
                    <p:panel  >
                        <f:facet name="header" >
                            <h:panelGroup>
                                <h:panelGrid columns="1">
                                    <p:outputLabel value="Search Channel Due Bills" />
                                </h:panelGrid>
                                <h:panelGrid columns="4">                                                       
                                    <h:outputLabel value="From Date"/>
                                    <p:calendar styleClass="dateTimePicker" id="fromDate" value="#{searchController.fromDate}" navigator="false" pattern="dd MMMM yyyy hh mm ss a" >                                   
                                    </p:calendar>
                                    <h:outputLabel value="To Date"/>
                                    <p:calendar styleClass="dateTimePicker" id="toDate" value="#{searchController.toDate}" navigator="false" pattern="dd MMMM yyyy hh mm ss a" >                                   
                                    </p:calendar>

                                </h:panelGrid>
                                <h:panelGrid columns="5">
                                    <h:outputLabel value="Bill No"/>
                                    <h:outputLabel value="Patient Name"/>
                                    <h:outputLabel value="Speciality"/> 
                                    <h:outputLabel value="Doctor Name"/>      
                                    <h:outputLabel value="Charges"/>
                                    <p:inputText autocomplete="off"  value="#{searchController.searchKeyword.billNo}" />
                                    <p:inputText autocomplete="off" value="#{searchController.searchKeyword.patientName}" />
                                    <p:inputText autocomplete="off"  value="#{searchController.searchKeyword.speciality}" />
                                    <p:inputText autocomplete="off"  value="#{searchController.searchKeyword.staffName}" />
                                    <p:inputText autocomplete="off" value="#{searchController.searchKeyword.total}"/>
                                </h:panelGrid>
                                <h:panelGrid columns="5">
                                    <p:selectBooleanCheckbox value="#{searchController.reportKeyWord.additionalDetails}" itemLabel="Search All" />
                                    <p:commandButton value="Search" ajax="false" action="#{searchController.createChannelDueBillFee()}" onclick="onSubmitButton();"/>
                                    <p:commandButton ajax="false" value="Excel" styleClass="noPrintButton" onclick="onSubmitButton();" >
                                        <pe:exporter type="xlsx" target="tblFee" fileName="channel_doc_pay_due"  />
                                    </p:commandButton>
                                </h:panelGrid>
                            </h:panelGroup>
                        </f:facet>
                        <br/><br/>
                        <p:dataTable   id="tblFee" value="#{searchController.billFees}" var="bf" sortBy="#{bf.bill.billClass}">
                            <p:column>
                                <p:commandButton ajax="false" value="Pay" 
                                                 action="channel_payment_staff_bill" 
                                                 actionListener="#{channelStaffPaymentBillController.calculateDueFees}">
                                    <f:setPropertyActionListener value="#{bf}" target="#{channelStaffPaymentBillController.billFee}"/>
                                </p:commandButton>
                            </p:column>
                            <p:column headerText="Consutant" filterBy="#{bf.staff.person.nameWithTitle}" filterMatchMode="contains">

                                <h:outputLabel value="#{bf.staff.person.nameWithTitle}">
                                </h:outputLabel>                                   

                            </p:column>

                            <p:column headerText="Patient" filterBy="#{bf.bill.patient.person.nameWithTitle}" filterMatchMode="contains">

                                <h:outputLabel value="#{bf.bill.patient.person.nameWithTitle}"/>                                    

                            </p:column>

                            <p:column headerText="BilledAt">

                                <h:outputLabel value="#{bf.bill.createdAt}">
                                </h:outputLabel>

                            </p:column>

                            <p:column headerText="Charge" rendered="#{webUserController.hasPrivilege('Developers')}">                                
                                <h:outputLabel value="#{bf.billItem.staffFee}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="paidValue" rendered="#{webUserController.hasPrivilege('Developers')}">                                
                                <h:outputLabel value="#{bf.paidValue}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="feeValue" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.feeValue}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="paidAmount" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.paidAmount}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="appointmentAt" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.appointmentAt}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="billClass" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.billClass}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="retired" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.retired}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="feeType" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.fee.feeType}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="refunded" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.refunded}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="cancelled" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.cancelled}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="billType" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.billType}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="absent" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.singleBillSession.absent}" ></h:outputLabel>                                    
                            </p:column>
                            <p:column headerText="bill" rendered="#{webUserController.hasPrivilege('Developers')}" >                                
                                <h:outputLabel value="#{bf.bill.insId}" ></h:outputLabel>                                    
                            </p:column>
                        </p:dataTable>

                    </p:panel>

                </h:form>
            </ui:define>


        </ui:composition>

    </h:body>
</html>
